#include "HkCameraHandler.h"
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include "thread"
#include "gtest/gtest.h"
using  namespace std;
template <typename T>
string ToString(T t)
{
  stringstream ss;
  ss<<t;
  return ss.str();
}

int main(){
    HkCameraHandler p;
    int rtn = p.start();
    if( rtn != 0){
        return -1;
    }
    DBGprint("break init\n");
    p.setExpouse(1500);
    std::this_thread::sleep_for(std::chrono::seconds(1));
    cv::Mat temp;
    for(int i = 0; i < 12000; i++){

        auto start = std::chrono::system_clock::now();

        cout << p.TrrigerOnce(MONO) <<endl;
        cout << p.getImageData(temp)<<endl;
        auto end = std::chrono::system_clock::now();
        auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
        std::cout <<  "图像耗时: "
             << double(duration.count()) * std::chrono::microseconds::period::num / std::chrono::microseconds::period::den   << "秒" << std::endl;

    }
    p.close();
    return 0;
}
